<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>
<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link type="text/css" rel="stylesheet" href="${ctx}/static/tools/jquery-validationEngine/validationEngine.jquery.css"></link>
		<link rel="stylesheet" href="${ctx}/static/threadui/css/select_css/style.css" />
		<link rel="stylesheet" href="${ctx}/static/threadui/css/select_css/select.css" />
		<link type="text/css"  rel="stylesheet" href="${ctx}/static/threadui/css/style.css">
	    <style type="text/css">
			.select_option{
				width: 300px;
				z-index: 1;
				position: absolute;
			}
			.select_showbox{
				width: 300px;
			}
			.checkRole{
				width: 45%;
				float: left;
				border-radius: 3px;
				box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
				cursor: text;
				line-height:22px;
				padding: 4px 6px;
				border: 1px solid #CAC5C5;
				margin-top: 5px;
				min-height: 100px;
				height: auto;
			}
			.checkRole attr{
				color: red;
			}
			.tenant_fill{width:100%}
			.tag{
				color: white;
				margin-right: 2px;
				padding: 0.2em 0.6em 0.3em;
				border-radius: 0.25em;
				color: white;
				font-size: 95%;
				line-height: 20px;
				text-align: center;
				white-space: nowrap;
				margin-top: 1px;
			}
			.label-success{
				background-color: #29C129;
			}
			.label-default{
				background-color: #7E7575;
			}
			.tag [class="tag-remove"]::after{
				content: "x";
				padding: 0.2px;
				cursor: pointer;
				font-weight: bold;
				margin-left: 5px;
			}
			.check_cinema_li{
				background-color: #F3F8FF;
				height: 30px;
				line-height: 30px;
				margin-top: 2px;
			    padding-left: 10px;
			    cursor: pointer;
			    border-radius: 4px;
   			}
			.nocheck_cinema_li{
				background-color: #F3F8FF;
				height: 30px;
				line-height: 30px;
				margin-top: 2px;
				padding-left: 10px;
				cursor: pointer;
			    border-radius: 4px;
			}
			.checked_div{
				height: 239px;
			}
			.positionSelect .select_box{
				margin-left: 0px;
			}
			.positionSelect{
				margin-right: 50px !important;
			}
	    </style>
	</head>
	<body>
		<div class="cinema_tip">
		    <div class="cinema_subject clearfix">
		        <div class="cinema_title">
		            <a href="javascript:void(0);">项目管理</a> >
		            <a id="userinfo_list_href" href="${ctx}/sys/sysProjectMan/ConstructionInfo/toSearch">施工队伍</a> >
		            <a href="javascript:void(0);" class="cinema_option">新建施工队伍</a>
		        </div>
		        <!-- <a onclick="javascript:history.back(-1);" class="movie_return">返回列表</a> -->
		        <a href="${ctx}/sys/sysProjectMan/ConstructionInfo/toSearch" class="movie_return">返回列表</a>
		    </div>
		</div>
		<div class="cinema_list">
			<form class="form-horizontal" onsubmit="return sysConsInfoAdd();" role="form" id="sysConsAddForm" name="sysConsAddForm" >
				<div class="movie_list">
				<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p style="background-image: none;">施工队伍所属项目: </p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed positionSelect">
								<c:choose>
									<c:when test="${projects.data!=null && fn:length(projects.data)>1}">
									<select id="proId" name="proId" class="validate[required]">
									<option class="department_opt" value="" >选择项目</option>
									<c:forEach var="res" items="${projects.data}">
										<option class="department_opt" value="${res.proId }">${res.name }</option>
									</c:forEach>
									</select>
									</c:when>
									<c:otherwise>
										<select id="proId" name="proId" >
										<c:forEach var="res" items="${projects.data}">
											<option class="department_opt" value="${res.proId }" selected="selected">${res.name }</option>
										</c:forEach>
										</select>
									</c:otherwise>
									
								</c:choose>
								
								
								
								
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
				
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>施工队编号：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="teamCode" type="text" name="teamCode" value="" class="validate[required,maxSize[100]]" maxlength="100" />
							</div> 
						</dd>
					</dl>
					<div class="clearfix"></div>
				
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>施工队名称：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="name" type="text" name="name" value="" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
				
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>单位名称：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="unit" type="text" name="unit" value="" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
				
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>专业类别：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="majorType" type="text" name="majorType" value="" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p>施工队负责人：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="leader" type="text" name="leader" value="" class="validate[required,maxSize[100]]" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<dl class="movie_fill">
						<dt class="movie_word clearfix">
							<p style="background-image: none;">负责人电话 ：</p>
						</dt>
						<dd class="mleft_99">
							<div class="movie_type cinema_feed">
								<input id="phone" type="text" name="phone" value="" class="width_320" maxlength="100" />
							</div>
						</dd>
					</dl>
					<div class="clearfix"></div>
					<a class="movie_continue">
						<input type="submit" name="submit" id="submit" value="提交" class="cinema_inquiry" />
					</a>
				</div>
			</form>
		</div>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine.js"></script>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine-cn.js"></script>
		<script type="text/javascript">
			function sysConsInfoAdd() {
				if ($("#sysConsAddForm").validationEngine("validate")) {
					var datastr = new Object();
	    			datastr.name = $('#name').val();
	    			datastr.teamCode = $('#teamCode').val();
	    			datastr.proId = $('#proId').val();
	    			datastr.unit = $('#unit').val();
	    			datastr.majorType = $('#majorType').val();
	    			datastr.phone = $('#phone').val();
	    			datastr.leader = $('#leader').val();
	    			
					var result = true;
					$.ajax({
	    		        async: true,
	    		        type:"POST",
	    		        data:JSON.stringify(datastr),
	    		        url: "${ctx}/sys/sysProjectMan/ConstructionInfo/add?&mid="+Math.random(),
	    		        dataType: "json",
	    		        headers : {  
	                        'Content-Type' : 'application/json;charset=utf-8'  
	                    },
	                    
	                    success : function(data) {
	                		if (data != undefined && data.status != undefined
	                				&& data.status.trim() == '0') {
	                			result = true;
	                			alert("保存成功！");
	                			window.location.href = "${ctx}/sys/sysProjectMan/ConstructionInfo/toSearch";
	                		} else {
	                			result = false;
	                			alert(data.error);
	                		}
	                	},
	    			},"json");
					
				}
				return false;
			}
			$("#sysConsAddForm").validationEngine();
			
		</script>
	</body>
</html>